import 'package:flame/components.dart';
import 'package:flutter_flame/config/AssetsName.dart';
import 'package:flutter_flame/component/SpriteEntity.dart';

class SeedPacketSilhouette extends SpriteEntity {
  int i; // 列号
  int j; // 行号
  double startX; // 横向偏移
  double startY; // 纵向偏移
  double gap; // 间隙

  SeedPacketSilhouette({
    required this.i,
    required this.j,
    required this.startX,
    required this.startY,
    required this.gap,
  }) : super(AssetsName.spriteSeedChooserSeedPacketSilhouette);

  @override
  Future<void> onLoad() async {
    await super.onLoad();
    final radio = sprite!.image.width / sprite!.image.height;
    final w = 60.0;
    position = Vector2(
      startX + i * (w + gap),
      startY + (w / radio + gap * 2) * j,
    );
    setSize(w);
  }
}
